<!DOCTYPE html>
<html lang="en">
<head>
    <title>管理系统 - 管理中心</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- <meta ng-include="'head.html'"> -->
    <style type="text/css">
        select{ height:25px;  }

        .titleHead { font-family: 宋体; font-size: 14px; font-weight: 400; margin-left: 5px }
        ul>li>a{ cursor: pointer;}
    </style>
    <link rel="stylesheet" type="text/css" href="../lib/css/footable.bootstrap.min.css">
    <script src="../lib/js/jquery.min.js" type="text/javascript"></script>
    <script src="../js/build.js" type="text/javascript"></script>
    <script src="../js/public.js" type="text/javascript"></script>
</head>
<body class="flat-blue">
<div class="app-container" ng-app="myApp" ng-controller="myCtrl">
<div class="row content-container">
<div ng-include="'menus.html'" onload="loadReady()"></div>
<div class="container-fluid">
<div class="side-body padding-top pb15" id="main" style="margin-bottom:10px; padding-top:65px">
    <!------------------Main---------------->
    <div style="width:97%; margin:0px 15px 15px 15px;">
        <div class="titleHead">➢数据详情</div>
        <table class="table table-striped" style="padding-bottom: 20px"></table>
    </div>
    <!------------------End Main---------------------->
</div>  <!--End side-body-->
</div>  <!--End container-fluid-->
</div>  <!--End content-container-->
<div ng-include="'footer.html'"></div>
</div>  <!--End app-container-->

<script type="text/javascript" src="../lib/js/footable.min.js"></script>
<script language="javascript">
    var app = angular.module('myApp', []);
    app.controller('myCtrl', function($scope) {
        loadCtlBase($scope);
        $scope.hideCols = { 'province':1, 'LO':1, 'LN':1, 'LAr':1 }; 
        $scope.cols = [];
        
        if(parseInt(getCookie('level'))<2){
            alert("请您升级为高级会员，查看详情的数据！");
            window.location.href="userAccount.html";
            return;
        }


        $scope.loadDevice = function (page){
            $scope.rows = [];
            ajaxData("get_device_list", {}, function(rst){ 
                var dt = rst.data;
                
                loadTable(dt);
            });    
        }

        function loadTable(dt){
            var width = $('.table').width(), maxW = width/4;
            var cols = [];
            dt.cols.forEach(function(d){
                var col = { 'name': d.field, 'title': d.name, style:'max-width:'+ maxW +'px' };
                if(!(d.field in $scope.hideCols))cols.push(col);
            });

            //// 数据呈现
            var rows = [];
            dt.rows.forEach(function(d, i){
                if('companyName' in d)d.companyName = "<a href='companyInfo.html?cp="
                    + escape(d.companyName) + "&pvn="
                    + escape(d.province) + "' title='点击查看详情'>" + d.companyName + "</a>";
                rows.push(d);
            });

            // 加载表格
            $('.table').footable({
                "paging": { "enabled": true, 'size':10 },
                "filtering": { "enabled": true },
                "sorting": { "enabled": true },
                "columns": cols,
                "rows": rows
            });
 
        }
        
        $scope.loadDevice();
        
    });


</script>

</body>
</html>
